<template>
  <div class="not-found">
    <div class="not-found-content">
      <div class="error-icon">
        <el-icon size="120" color="#2e7d32"><Warning /></el-icon>
      </div>
      <h1 class="error-title">404</h1>
      <h2 class="error-subtitle">页面不存在</h2>
      <p class="error-description">
        抱歉，您访问的页面不存在或已被删除。
        <br>请检查URL是否正确，或返回首页继续浏览。
      </p>
      <div class="error-actions">
        <el-button type="primary" size="large" @click="goHome">
          <el-icon><House /></el-icon>
          返回首页
        </el-button>
        <el-button size="large" @click="goBack">
          <el-icon><Back /></el-icon>
          返回上页
        </el-button>
      </div>
      <div class="error-help">
        <p>您也可以尝试以下链接：</p>
        <el-space wrap>
          <el-button type="text" @click="$router.push('/projects')">课题库</el-button>
          <el-button type="text" @click="$router.push('/about')">关于平台</el-button>
          <el-button type="text" @click="$router.push('/login')">用户登录</el-button>
        </el-space>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { Warning, House, Back } from '@element-plus/icons-vue'

const router = useRouter()

const goHome = () => {
  router.push('/')
}

const goBack = () => {
  router.go(-1)
}
</script>

<style scoped>
.not-found {
  min-height: 100vh;
  background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.not-found-content {
  text-align: center;
  max-width: 600px;
}

.error-icon {
  margin-bottom: 24px;
}

.error-title {
  font-size: 72px;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0 0 16px;
  line-height: 1;
}

.error-subtitle {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 24px;
}

.error-description {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 32px;
}

.error-actions {
  margin-bottom: 40px;
}

.error-actions .el-button {
  margin: 0 12px;
  padding: 12px 24px;
  border-radius: 8px;
}

.error-actions .el-button .el-icon {
  margin-right: 8px;
}

.error-help {
  padding: 24px;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.error-help p {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

.error-help .el-button {
  color: var(--primary-color);
}

.error-help .el-button:hover {
  color: var(--primary-light);
}
</style>
